#include <stdio.h>
#include <string.h>





int vcmd_hash(const char* str, int start, int end)
{
    int  p, ret, key;
    char ch;

    if((start < 0) || (end < 0) || (start>end)){
        return end+1;
    }else{
        ret = 0;
        p   = 0;
        key = 77;
        while(str[p]){
            ch  = str[p]-'a';
            //ret += (ret<<(ch%sizeof(ret))^ch*(key<<p%sizeof(key))+ch*key*p);
            ret += ch*key;
            p++;
        }
        return ret%(end-start+1) + start;
    }
}



int func(int arg)
{
    int b;

    b = arg;
    return b + arg +1;
}

int main()
{
    int a;
    int b;

    a = 2;
    b = 3;
    
    printf("%d\n",vcmd_hash("quit"    , 0, 255));
    printf("%d\n",vcmd_hash("step"    , 0, 255));
    printf("%d\n",vcmd_hash("run"     , 0, 255));
    printf("%d\n",vcmd_hash("break"   , 0, 255));
    printf("%d\n",vcmd_hash("continue", 0, 255));
    printf("%d\n",vcmd_hash("clear"   , 0, 255));

    return a+b+func(a);
}
